def frec(l1, x, n):
    if not n:
        return l1
    else:
        return [x] + frec(l1, x, n-1)
      
l2 = frec([], 'BA', 5)
print l2


def fatorial_cauda(n):
   def  fact(i = n, acc = 1):
      if i == 0:
         return acc
      else:
         print i, acc
         return fact(i - 1, (acc * i))
   return fact()

fatorial_cauda(5)


lista = ['a', 'b', 'c']
it = iter(lista)
print it
x1 = it.next()
print x1
x2 = it.next()
print x2

lista = ['a', 'b', 'c', 'd', 'e']
it = iter(lista)
x = it.next()
while it:
   print x
   x = it.next()

